package com.og.backingbean;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;

import org.hibernate.validator.constraints.NotEmpty;

/**
 * @author Renaud DIANA
 *
 */
@Entity
@NamedQueries({@NamedQuery(name = "TimeSheetDate.findAll", query = "SELECT t FROM TimeSheetDate t ORDER BY t.date ASC")})
public class TimeSheetDate implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idTimeSheetDate;
	@NotNull
	@Past
	@Column(nullable = false)
	@Temporal(TemporalType.DATE)
	private Date date;
	@NotNull
	@Column(nullable = false, columnDefinition = "Decimal(5,2)")
	private float hour;
	@NotNull
	@NotEmpty
	@Column(nullable = false)
	private String done;
	@NotNull
	@ManyToOne
	@JoinColumn(nullable = false)
	private TimeSheet timeSheet;
	
	/**
	 * default constructor
	 */
	public TimeSheetDate() {
		// TODO Auto-generated constructor stub
	}

	public int getIdTimeSheetDate() {
		return idTimeSheetDate;
	}

	public void setIdTimeSheetDate(int idTimeSheetDate) {
		this.idTimeSheetDate = idTimeSheetDate;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public float getHour() {
		return hour;
	}

	public void setHour(float hour) {
		this.hour = hour;
	}

	public String getDone() {
		return done;
	}

	public void setDone(String done) {
		this.done = done;
	}

	public TimeSheet getTimeSheet() {
		return timeSheet;
	}

	public void setTimeSheet(TimeSheet timeSheet) {
		this.timeSheet = timeSheet;
	}

}
